package activity_mapper

type T6006GPS struct {
	Latitude  string `json:"latitude"`
	Longitude string `json:"longitude"`
	Province  string `json:"province"`
	TrueTrack string `json:"true_track"`
	SpeedKmh  string `json:"speed_kmh"`
}

func (t T6006GPS) ToMap() map[string]interface{} {
	return map[string]interface{}{
		"latitude":   t.Latitude,
		"longitude":  t.Longitude,
		"province":   t.Province,
		"true_track": t.TrueTrack,
		"speed_kmh":  t.SpeedKmh,
	}
}

type T6006 struct {
	ISP     string                 `json:"isp"`
	Signal  int                    `json:"signal"`
	Service string                 `json:"service"`
	Yaw     string                 `json:"yaw"`
	Time    string                 `json:"time"`
	Depth   string                 `json:"depth"`
	Mac     string                 `json:"mac"`
	Pitch   string                 `json:"pitch"`
	Roll    string                 `json:"roll"`
	GPS     T6006GPS               `json:"gps"`
	JSON    map[string]interface{} `json:"json"`
}

func (t T6006) ToMap() map[string]interface{} {
	json := map[string]interface{}{}
	if t.JSON != nil {
		json = t.JSON
	}
	return map[string]interface{}{
		"isp":     t.ISP,
		"signal":  t.Signal,
		"service": t.Service,
		"yaw":     t.Yaw,
		"time":    t.Time,
		"depth":   t.Depth,
		"mac":     t.Mac,
		"pitch":   t.Pitch,
		"roll":    t.Roll,
		"gps":     t.GPS.ToMap(),
		"json":    json,
	}
}
